home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
ARMLINUX
/
REMOUNT-PATCH
< prev
next >
Wrap
Text File
|
1998-09-06
|
2KB
|
68 lines
--- fs/super.c.orig Mon Aug 18 21:01:15 1997
+++ fs/super.c Mon Jun 8 22:28:38 1998
@@ -771,21 +771,48 @@
return 0;
}
-static int do_remount(const char *dir,int flags,char *data)
+static int do_remount(const char *dev, const char *dir,int flags,char *data)
{
struct inode *dir_i;
int retval;
- retval = namei(dir, &dir_i);
- if (retval)
+ if ((retval = namei(dir, &dir_i)))
+ return retval;
+ if ((retval = do_remount_sb(dir_i->i_sb, flags, data)))
return retval;
if (dir_i != dir_i->i_sb->s_mounted) {
+ struct inode *dev_i;
+ struct vfsmount *vfsmnt;
+ if ((retval = namei(dev, &dev_i)))
+ return retval;
+ vfsmnt = lookup_vfsmnt(dev_i->i_rdev);
+ if (!vfsmnt) return 0; /* I dunno... but it's consistent */
+ if (dir_i->i_count != 1 || dir_i->i_mount
+ || dir_i->i_sb->s_dev == dev_i->i_rdev) {
+ iput(dir_i);
+ return -EBUSY;
+ }
+ if (!S_ISDIR(dir_i->i_mode)) {
+ iput(dir_i);
+ return -ENOTDIR;
+ }
+ /* Note that the tests here are not complete. Nothing
+ stops the incompetent sysadmin remounting /a on /a/b/a
+ if b is a different filesystem. This would be tricky
+ to implement and probably pointless. mount(8) would
+ be a better place to put sanity checks, I believe */
+ iput(vfsmnt->mnt_sb->s_covered);
+ vfsmnt->mnt_sb->s_covered->i_mount = NULL;
+ vfsmnt->mnt_sb->s_covered = dir_i;
+ dir_i->i_mount = vfsmnt->mnt_sb->s_mounted;
+ kfree(vfsmnt->mnt_dirname);
+ if ((vfsmnt->mnt_dirname =
+ (char *) kmalloc(strlen(dir)+1, GFP_KERNEL)) != (char *)NULL)
+ strcpy(vfsmnt->mnt_dirname, dir);
+ } else {
iput(dir_i);
- return -EINVAL;
}
- retval = do_remount_sb(dir_i->i_sb, flags, data);
- iput(dir_i);
- return retval;
+ return 0;
}
static int copy_mount_options (const void * data, unsigned long *where)
@@ -847,7 +874,7 @@
retval = copy_mount_options (data, &page);
if (retval < 0)
return retval;
- retval = do_remount(dir_name,
+ retval = do_remount(dev_name, dir_name,
new_flags & ~MS_MGC_MSK & ~MS_REMOUNT,
(char *) page);
free_page(page);